/**
 * 闲的没事写个程序算算帝都每个月地铁费
 * Created by Aikes on 2018-10-09.
 */
public class ComputeSubwayCost
{
	/**
	 * 
	 * @param cBusPriceAM 早上公交费
	 * @param cSubPriceAM 早上地铁费
	 * @param cSubPricePM 晚上地铁费
	 * @param cBusPricePM 晚上公交费
	 * @param cCount 自然月出行天数
	 * @return
	 */
	public static double DealData(double cBusPriceAM,double cSubPriceAM, double cSubPricePM, double cBusPricePM ,int cCount)
	{
		double tSumCost = 0.00;
		boolean tFlag = true;
		double tCurrentPrice = 0.00;
		double tCurrentPrice_8 = 0.00;
		double tCurrentPrice_5 = 0.00;
		
		for (int i = 1; i <= 2 * cCount; i++)
		{
			if (i % 2 == 0)
			{
				tCurrentPrice = cSubPriceAM;
				tCurrentPrice_8 = cSubPriceAM * 0.8;
				tCurrentPrice_5 = cSubPriceAM * 0.5;
			}
			else
			{
				tCurrentPrice = cSubPricePM;
				tCurrentPrice_8 = cSubPricePM * 0.8;
				tCurrentPrice_5 = cSubPricePM * 0.5;
			}

			tSumCost += cBusPriceAM;
			
			if (tSumCost < 100.00)
			{
				tSumCost += tCurrentPrice;
			}
			else if (100.00 <= tSumCost && tSumCost < 150.00)
			{
				if (tFlag)
					System.out.println("该自然月第" + i / 2 + "天出行时累计消费超出100元开始打八折：" + tSumCost + "");
				tFlag = false;
				tSumCost += tCurrentPrice_8;
			}
			else if (tSumCost >= 150.00)
			{
				if (!tFlag)
					System.out.println("该自然月第" + i / 2 + "天出行时累计消费超出150元开始打五折：" + tSumCost + "");
				tFlag = true;
				tSumCost += tCurrentPrice_5;
			}
			else
			{
				System.out.println("地铁单日消费金额或自然月消费天数有误！");
				tSumCost = 0.00;
			}
			
			tSumCost += cBusPricePM;
		}
		System.out.println("该自然月共计出行" + cCount + "天，累计消费：" + tSumCost);
		return tSumCost;
	}

	public static void main(String[] args)
	{
		ComputeSubwayCost.DealData(0.00,6.00,5.00,1.00,23);
	}
}
